<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>展示</title>
    <link rel="stylesheet" href="/static/css/bootstrap.min.css">
</head>
<body>
<button class="btn-primary add">添加商品</button>
<table class="table">
    <tr>
        <th><input type="checkbox" class="allcheck"></th>
        <th>ID</th>
        <th>商品名称</th>
        <th>商品图片</th>
        <th>商品单价</th>
        <th>商品数量</th>
        <th>商品小计</th>
        <th>操作</th>
    </tr>
    {foreach $data as $k=>$v}
    <tr>
        <td><input type="checkbox" class="onecheck" id="{$v.id}"></td>
        <td>{$v.id}</td>
        <td>{$v.name}</td>
        <td><img src="{$v.img}" width="80px"></td>
        <td>{$v.price}</td>
        <td>{$v.num}</td>
        <td>xiaoji</td>
        <td><a href="delete?id={$v.id}">删除</a></td>
        <td></td>
    </tr>
    {/foreach}
</table>
</body>
<script src="/static/js/jquery-3.1.1.min.js"></script>
<script>
    $(function () {
          $('.add').click(function () {
                     location.href='create';
          })
        $('.onecheck').click(function () {
                var id=('.onecheck').attr('id');
            console.log(id);
        })

    })
</script>
</html>